/**
 * Randomize array element order in-place.
 * Using Fisher-Yates shuffle algorithm.
 */
 
Array.prototype.shuffle = function() {
    for (var i = this.length - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var temp = this[i];
        this[i] = this[j];
        this[j] = temp;
    }
    return this;
}

Array.prototype.remove = function(element) {
	this.splice(this.indexOf(element), 1);
}

Array.prototype.head = function() {
	return this[0];
}

Array.prototype.tail = function() {
	return this[this.length - 1];
}